package com.sm.healthy.data.dao

import androidx.lifecycle.LiveData
import androidx.room.*
import com.sm.healthy.data.bean.BloodPressureEntity
import com.sm.healthy.data.bean.EcgEntity
import com.sm.healthy.data.bean.FetalEntity

/**
 * @description
 * @author csw
 * @date 2021-05-05
 */
@Dao
interface FetalDao {
    @Insert
    suspend fun insert(fetalEntity: FetalEntity)

    @Update
    suspend fun update(fetalEntity: FetalEntity)

    @Delete
    suspend fun delete(fetalEntity: FetalEntity)

    @Query("Delete FROM fetal")
    suspend fun deleteAll()

    @Query("SELECT * FROM fetal")
    fun getFetal(): LiveData<List<FetalEntity>>

    @Query("SELECT * FROM fetal WHERE  timeLong >:before and timeLong <:after")
    fun getFetalByTime(before: Long, after: Long): LiveData<List<FetalEntity>>
}